package design.pattern.SimpleFactory;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) throws Exception{

        //获取两个数
        Scanner scanner = new Scanner(System.in);
        //获取操作
        System.out.println("请输入被操作数");
        double a = scanner.nextDouble();
        System.out.println("请输入操作数");
        double b = scanner.nextDouble();
        System.out.println("请输入运算符");
        String oper = scanner.next();
        //运算
        Operation operation = OperationFactory.create(oper);
        operation.setNumberA(a);
        operation.setNumberB(b);
        //返回结果
        System.err.println(String.valueOf(operation.getResult()));
    }
}
